<!DOCTYPE html>
<html>
    <head>
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'employeePosition.label', default: 'EmployeePosition')}" />
        <title>新增员工岗位信息</title>
    </head>
    <body class="fixed-navbar fixed-sidebar">
    <div class="small-header">
        <div class="hpanel">
            <div class="panel-body">
                <div id="hbreadcrumb" class="pull-right m-t-lg">
                    <ol class="hbreadcrumb breadcrumb">
                        <li>Next CRM</li>
                        <li><g:link controller="employee" action="index">员工岗位信息</g:link></li>
                        <li class="active">
                            <span>新增员工岗位信息</span>
                        </li>
                    </ol>
                </div>
                <h2 class="font-light m-b-xs">新增员工岗位信息</h2>
            </div>
        </div>
    </div>
    <div class="content animate-panel">
        <div class="row">
            <div class="hpanel hblue">
                <div class="panel-heading">
                    新增员工岗位信息
                </div>
                <div class="panel-body">
                    <g:if test="${flash.message}">
                        <div class="message alert alert-info" role="status">
                            <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span
                                    aria-hidden="true">×</span></button>
                        </div>
                    </g:if>
                    <g:hasErrors bean="${this.employeePosition}">
                        <ul class="errors" role="alert">
                            <g:eachError bean="${this.employeePosition}" var="error">
                                <li <g:if test="${error in org.springframework.validation.FieldError}">data-field-id="${error.field}"</g:if>><g:message error="${error}"/></li>
                            </g:eachError>
                        </ul>
                    </g:hasErrors>

                    <g:form action="save" class="form-horizontal">
                        <div class="form-group row">
                            <label class="col-md-3 control-label">员工</label>
                            <div class="col-md-4">
                                <g:select class="form-control" noSelection="${['':'请选择']}" name="employee" id="employee" optionKey="id" optionValue="fullName" from="${com.next.Employee.list()}" value="${params.employee}"/>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group row">
                            <label class="col-md-3 control-label">岗位</label>
                            <div class="col-md-4">
                                <g:select class="form-control" noSelection="${['':'请选择']}" name="position" id="position" optionKey="id" optionValue="name" from="${com.next.Position.findAllByActive(true)}"/>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group row">
                            <label class="col-md-3 control-label">开始时间</label>
                            <div class="col-md-4">
                                <g:datePicker class="form-control" name="startTime" id="startTime" value="${this.employeePosition?.startTime}" precision="minute" years="${1990..2050}"/>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group row">
                            <label class="col-md-3 control-label">截止时间</label>
                            <div class="col-md-4">
                                <g:datePicker class="form-control" name="endTime" id="endTime" value="${this.employeePosition?.endTime}" precision="minute" years="${1990..2050}"/>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group ">
                            <label class="col-md-3 control-label">是否启用</label>
                           <div class="col-md-4">
                                <input type="hidden" value="${this.employeePosition?.active}" id="active">

                                <div class="radio radio-info radio-inline ">
                                    <input type="radio" name="active" value="true" id="radio1">
                                    <label for="radio1">true</label>
                                </div>

                                <div class="radio radio-info radio-inline ">
                                    <input type="radio" name="active" value="false" id="radio2">
                                    <label for="radio2">false</label>
                                </div>
                            </div>
                        </div>
                        <div class="hr-line-dashed"></div>
                        <div class="form-group ">
                            <label class="col-md-3 control-label">是否主要</label>
                           <div class="col-md-4">
                                <input type="hidden" value="${this.employeePosition?.isPrimary}" id="isPrimary">

                                <div class="radio radio-info radio-inline ">
                                    <input type="radio" name="isPrimary" value="true" id="radio1">
                                    <label for="radio1">true</label>
                                </div>

                                <div class="radio radio-info radio-inline ">
                                    <input type="radio" name="isPrimary" value="false" id="radio2">
                                    <label for="radio2">false</label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group row">
                            <div class="col-md-7">
                                <g:submitButton class="btn btn-info" name="save" value="保存"/>
                            </div>
                        </div>
                    </g:form>
                </div>
            </div>
        </div>
    </div>
    <script>
        $(function(){
            if ($("#active").val() == "true") {
                $("#radio1")[0].checked = true;
            } else {
                $("#radio2")[0].checked = true;
            }
            if ($("#isPrimary").val() == "true") {
                $("#radio1")[0].checked = true;
            } else {
                $("#radio2")[0].checked = true;
            }
        })
    </script>
    </body>
</html>